package cz.kfad.ofrss.activity;


import cz.kfad.ofrss.backend.BackendService;
import cz.kfad.ofrss.backend.IBackend;
import cz.kfad.ofrss.model.RssFeedShort;

import java.util.List;

public class ChannelActivity extends FeedListActivity {

    public static final String CHANNEL_ID_KEY = "CHANNEL_ID_KEY";

    private IBackend backend = BackendService.createBackend(this);

    @Override
    protected CharSequence getActivityTitle() {
        final int channelId = getIntent().getIntExtra(CHANNEL_ID_KEY, -1);
        return backend.findChannelById(channelId).getName();
    }

    @Override
    protected List<RssFeedShort> getFeedList() {
        final int channelId = getIntent().getIntExtra(CHANNEL_ID_KEY, -1);
        return backend.findFeedsForChannel(channelId);
    }


}
